﻿using Cysharp.Threading.Tasks;
using Internal.KuiHuaBaoDian.Services.Guide;
using UnityEngine;

namespace KuiHuaBaoDian.Services.Guide {

    [NodeTitle("等待几秒")]
    public sealed class GuideCommand_WaitSeconds : GuideCommand {

        [SerializeField, Label("秒")]
        private float m_Seconds;
        public float Seconds => m_Seconds;

        protected override void Dispose() {
        }

        protected override async UniTask Execute() {
            if (m_Seconds > 0f) {
                (GuideService.Instance as IGuideServiceInternal).StartWait();
                await UniTask.WaitForSeconds(m_Seconds);
                (GuideService.Instance as IGuideServiceInternal).EndWait();
            }
        }
    }
}
